﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entities
{
    [Serializable]
    public class Seates
    {
        private int seatNo;
        private int coachNo;
        public Seates()
        { }
        public Seates(int seatNo, int coachNo)
        {
            this.seatNo = seatNo;
            this.coachNo = coachNo;
        }
        public int SeatNo
        {
            get { return this.seatNo; }
            set
            {
                if (value < 0)
                    throw new Exception("seatNo not allow nullvalue.");
                this.seatNo = value;
            }
        }
        public int CoachNo
        {
            get { return this.coachNo; }
            set { this.coachNo = value; }
        }
        public override string ToString()
        {
            return this.seatNo + "; " + this.coachNo + "; ";
        }
        public override bool Equals(Object obj)
        {
            Seates me = (Seates)obj;
            bool ret = this.SeatNo.Equals(me.SeatNo);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.SeatNo.GetHashCode();
        }

    }
}